package com.nowc.ex.e143;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.*;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        int T = Integer.parseInt(br.readLine());
        while (T-- > 0) {
            solve();
        }
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        String[] s = br.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        s = br.readLine().split(" ");
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(s[i]) + 200;
        }

        int pairs = 0;
        int[] tot = new int[401];
        int[][] arr = new int[401][401];
        for (int i = 0; i <= 400; i++) {
            tot[i] = 0;
            for (int j = i + 1; j <= 400; j++)
                arr[i][j] = 0;
        }
        for (int i = 0; i < n / 2; i++)
            if (a[i] != a[n - 1 - i]) {
                pairs++;
                tot[a[i]]++;
                tot[a[n - 1 - i]]++;
                arr[Math.min(a[i], a[n - 1 - i])][Math.max(a[i], a[n - 1 - i])]++;
            }
        int res = pairs * 2;
        for (int i = 0; i <= 400; i++)
            for (int j = i + 1; j <= 400; j++)
            {
                int tmp = tot[i] + tot[j] - arr[i][j];
                res = Math.min(res, tmp + (pairs - tmp) * 2);
            }
        out.println(res);

    }
}
